<template>
  <div class="dashboard-container">
    <div class="app-container">
      <el-card shadow="never">
        <el-form
      :inline="true"
      :model="dataForm"
      @keyup.enter.native="getList()"
    >
      <el-form-item>
        <el-input
          v-model="dataForm.key"
          placeholder="参数名"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="getList()">查询</el-button>
        <!-- <el-button
          v-if="isAuth('order:pmsbrand:save')"
          type="primary"
          @click="addOrUpdateHandle()"
          >新增</el-button
        > -->
        <!-- <el-button
          v-if="isAuth('order:pmsbrand:delete')"
          type="danger"
          @click="deleteHandle()"
          :disabled="dataListSelections.length <= 0"
          >批量删除</el-button
        > -->
      </el-form-item>
    </el-form>
         <!-- 数据 -->
        <el-table :data="dataList"  fit highlight-current-row style="width: 100%" border>
          <el-table-column type="index" align="center" label="序号" >
          </el-table-column>
          <el-table-column align="center" label="公司名称" >
            <template slot-scope="scope">
              <span>{{scope.row.name}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="登录账号ID">
            <template slot-scope="scope">
              <span>{{scope.row.managerId}}</span>
            </template>
          </el-table-column>
          <el-table-column  align="center" label="法人代表">
            <template slot-scope="scope">
              <span>{{scope.row.legalRepresentative}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="创建时间">
            <template slot-scope="scope">
              <span>{{scope.row.createTime}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="余额">
            <template slot-scope="scope">
              <span>{{scope.row.balance}}</span>
            </template>
          </el-table-column>
           <el-table-column align="center" label="状态" width="250">
            <template slot-scope="scope">
              <el-switch
                v-model="scope.row.state"
                :inactive-value=0
                :active-value=1
                active-color="#13ce66"
                inactive-color="#ff4949">
              </el-switch>
            </template>
          </el-table-column>
          <el-table-column label="操作">
      <template slot-scope="scope">
        <router-link
          :to="'/saas-client/info/'+scope.row.id"><el-button size="mini" type='info' icon="el-icon-info"></el-button></router-link>
        <el-button
          size="mini"
          type='primary'
          icon="el-icon-edit"
          @click="handleEdit(scope.$index, scope.row)"></el-button>
        <el-button
          size="mini"
          type="danger"
          icon="el-icon-delete"
          @click="handleDelete(scope.$index, scope.row)"></el-button>
      </template>
    </el-table-column>
        </el-table>
      </el-card>
     </div>
  </div>
</template>

<script>
import {list} from '@/api/base/saasClient'
export default {
  name: 'saas-clients-index',
  data() {
    return {
      dataForm: {
        key: ''
      },
      dataList: []

    }
  },
  methods: {
    // 调用Api
    // res代表回调函数
    getList() {
      this.dataListLoading = true
      list().then(res => {
        var Datas = res.data
        if (Datas.code === 0) {
          this.dataList = Datas.data
        } else {
          this.dataList = []
        }

      })
    }

  },
  // 创建完毕状态
  created() {
    this.getList()
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
</style>
